package com.gyz.cfmall.service;

import com.gyz.cfmall.vo.CartItemVo;
import com.gyz.cfmall.vo.CartVo;

import java.util.concurrent.ExecutionException;

/**
 * @author gong_yz
 * @Description
 * @Date 2023/4/19
 */
public interface CartService {
    /**
     * 添加商品到购物车
     *
     * @param skuId
     * @param num
     * @return
     */
    CartItemVo addCartItem(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 获取购物车某个购物项
     *
     * @param skuId
     * @return
     */
    CartItemVo getCartItem(Long skuId);

    /**
     * 清空购物车的数据
     *
     * @param cartKey
     */
    void clearCartInfo(String cartKey);

    /**
     * 获取整体购物车信息，包括子项信息
     *
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    CartVo getCart() throws ExecutionException, InterruptedException;

    /**
     * 勾选购物项
     *
     * @param skuId
     * @param checked
     */
    void checkItem(Long skuId, Integer checked);

    /**
     * 改变商品数量
     * @param skuId
     * @param num
     */
    void changeItemCount(Long skuId, Integer num);

    /**
     * 删除购物项
     * @param skuId
     */
    void deleteIdCartInfo(Integer skuId);
}
